package com.ssy.lingxi.pay.common;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 授信还款状态
 *
 * @author 伍将
 * @version 2.0.0
 * @date 2020/8/11 14:30
 */
public enum CreditRepayStatusEnum {

    /**
     * 所有
     */
    ALL(0, "所有状态", ""),
    /**
     * 账单待还
     */
    WAIT_REPAY(1, "账单待还", ""),
    /**
     * 待确认还款结果
     */
    WAIT_CONFIRM(2, "待确认还款结果", "待确认还款结果"),
    /**
     * 账单已还清
     */
    PAY_OFF(3, "账单已还清", ""),
    /**
     * 逾期
     */
    OVERDUE(4, "逾期", "逾期");

    private final Integer code;
    private final String remark;

    CreditRepayStatusEnum(Integer code, String message, String remark) {
        this.code = code;
        this.remark = remark;
    }

    public static CreditRepayStatusEnum getItem(int code) {
        return Arrays.stream(CreditRepayStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL);
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(),this.code);
    }

    public String getRemark() {
        return remark;
    }
}
